const {performance,PerformanceObserver} = require('perf_hooks')
const add = (a,b)=>a+b;

const num1= 1
const num2= 2

performance.mark('start')
for (let index = 0; index < 1000000000; index++) {
   add(num1,num2)   
}

// add(num1,'s')

for (let index = 0; index < 1000000000; index++) {
    add(num1,num2)   
 }

 performance.mark('end')

 const observer = new PerformanceObserver(list=>{
     console.log(list.getEntries()[0]);
 })
 observer.observe({entryTypes:['measure']})

 performance.measure('测量1','start','end')